package com.zmzncs.lmtc.module.promotion.controller;


import com.zmzncs.lmtc.common.pojo.Rest;
import com.zmzncs.lmtc.common.util.JsonUtil;
import com.zmzncs.lmtc.common.util.RestUtil;
import com.zmzncs.lmtc.module.promotion.pojo.customize_rule.CustomizeRuleVO;
import com.zmzncs.lmtc.module.promotion.pojo.month_rule_park.MonthRulePark;
import com.zmzncs.lmtc.module.promotion.pojo.month_rule_park.MonthRuleParkDTO;
import com.zmzncs.lmtc.module.promotion.pojo.month_rule_park.MonthRuleParkVO;
import com.zmzncs.lmtc.module.promotion.service.MonthRuleParkService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 任建波
 * @since 2020-08-12
 */
@Api(tags = "月租规则的停车场")
@RestController
@RequestMapping("/promotion/month-rule-park")
public class MonthRuleParkController {

    @Autowired
    MonthRuleParkService monthRuleParkService;

    @ApiOperation(value = "查询月租规则的停车场")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "请求头token", required = true),
            @ApiImplicitParam(paramType="query", name="keyword", value="搜索关键字"),
    })
    @GetMapping(value = "getMonthRuleParkList")
    public Rest<List<MonthRuleParkVO>> getMonthRuleParkList(String keyword) {
        List<MonthRuleParkDTO> monthRuleParkDTOList = monthRuleParkService.getMonthRuleParkList(keyword);
        List<MonthRuleParkVO> monthRuleParkVOList = JsonUtil.listTransform(monthRuleParkDTOList, MonthRuleParkVO.class);
        return RestUtil.success(monthRuleParkVOList);
    }

}

